package pl.polidea.constrainedbuffer;

import java.io.IOException;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ConstrainedBuffer<String> stringBuffer = null;
        try {
            stringBuffer = new ConstrainedBuffer<String>(getCacheDir());
        } catch (final IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (final ClassNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        stringBuffer.setCardinalityConstraint(5);
        stringBuffer.setSizeConstraint(128);

        try {
            stringBuffer.add("1");
            stringBuffer.add("2");
            stringBuffer.add("3");
            stringBuffer.add("4");
            stringBuffer.add("5");
            stringBuffer.add("6");
            stringBuffer.add("7");
        } catch (final IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
